package com.zyncro.user;

import java.util.HashMap;
import java.util.Map;

public class ZyncroUser{

	private String email;
	private String appId;
	private String password;
	
	private Map<String, Object> properties = new HashMap<String, Object>();

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getAppId() {
		return appId;
	}

	public void setAppId(String appId) {
		this.appId = appId;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Map<String, Object> getProperties() {
		return properties;
	}

	public void setProperties(Map<String, Object> properties) {
		this.properties = properties;
	}

	public <T> T getProperty(String name) {
		
		if(properties.containsKey(name)){
			
			@SuppressWarnings("unchecked")
			T property = (T) properties.get(name);
			return property;
		}
		else
			throw new IllegalStateException(String.format("User doesn't contain property name '%s'", name));
	}

	public boolean hasProperty(String name) {
		return properties.containsKey(name);
	}
}
